﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using BattleShips.Common;

namespace BattleShips.GameClients {
    static class CommandProxy {
        public static void Send(this Command cmd, TcpClient destination) {
            NetworkStream s = destination.GetStream();
            string commComm = cmd.ToString();
            s.Write(StrToByteArray(commComm), 0, commComm.Length);
        }

        public static void Send(this Command cmd, TcpClient destination, Action<Response> onResponse) { }

        private static byte[] StrToByteArray(string str) {
            System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
            return encoding.GetBytes(str);
        }
    }
}
